<?php
if ( !defined('IN_ADMINCP') || !defined('IN_SEC') ){
	exit('Access Denied.');
}

$acts = array(
	'insert_contact'
);
$act = in_array($_G['gp_act'], $acts, true) ? $_G['gp_act'] : '';
$dataid = intval(abs($_G['gp_dataid']));
if ( $act == 'insert_contact' ){
	$type = $_G['gp_type'];
	$content = htmlspecialchars($_G['gp_content']);
	if( !$type || !$content ){
		jsonp('资料填写不完整', 'alert', 1);
	}
	DB::Insert('customer_contacts', array(
		'adminid' => $admincp->adminid,
		'customerid' => $customer['id'],
		'type' => $type,
		'content' => $content,
		'create_time' => SYS_TIME
	));
	update('customer', $customer['id'], array(
		'last_contact_time' => SYS_TIME
	));
	jsonp('操作成功');
}